package com.xh.shuati.service.impl;
import com.xh.shuati.ai.AiService;
import com.xh.shuati.ai.AiServiceVisualConfig;
import com.xh.shuati.service.DummyInterviewService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;

import javax.annotation.Resource;


/**
 *
 *ai模拟面试服务
 * @author <a href="https://github.com/canon0521">xh</a>
 */
@Service
@Slf4j
public class DummyInterviewServiceImpl implements DummyInterviewService {

    @Resource
    private AiService aiService;

    @Resource
    private AiServiceVisualConfig aiServiceVisual;

    /**
     * 普通对话
     * @param interviewId
     * @param query
     * @return
     */
    @Override
    public String interview(Long interviewId, String query) {
        return aiService.chat(interviewId, query);
    }

    @Override
    public Flux<String> interviewStream(Long interviewId, String query) {
        return aiService.chatStream(interviewId, query);
    }


    /**
     * 多模态对话
     * @param interviewId
     * @param query
     * @param imagePath
     * @return
     */
    @Override
    public String interviewByMulti(Long interviewId, String query, String imagePath) {
        return aiServiceVisual.vlChat(interviewId, query, imagePath);
    }

    @Override
    public Flux<String> interviewByMultiStream(Long interviewId, String query, String imagePath) {
        return aiServiceVisual.vlChatStream(interviewId, query, imagePath);
    }
}
